using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using Entities;
using DAL;
namespace BUS
{
    public class tbTrangThaiDHBUS
    {
        public static void Insert(tbTrangThaiDH sp)
        {
            tbTrangThaiDHDAL spDAL = new tbTrangThaiDHDAL();
            spDAL.Insert(sp);
        }
        public static void Update(tbTrangThaiDH sp)
        {
            tbTrangThaiDHDAL spDAL = new tbTrangThaiDHDAL();
            spDAL.Update(sp);
        }


        public static void Detele(int iD)
        {
            tbTrangThaiDHDAL spDAL = new tbTrangThaiDHDAL();
            spDAL.Delete(iD);
        }

        public static tbTrangThaiDHCollection Get(string where, int pageIndex, int pageSize, string orderBy, string orderDirection, out int total)
        {
            tbTrangThaiDHDAL spDAL = new tbTrangThaiDHDAL();
            return spDAL.Get(where, pageIndex, pageSize, orderBy, orderDirection, out total);
        }
        public static tbTrangThaiDHCollection GetAll()
        {
            int total = 0;
            tbTrangThaiDHDAL spDAL = new tbTrangThaiDHDAL();
            return spDAL.Get("where 1=1", 0, 0, tbTrangThaiDHColumns.IdTrangThaiDH.ToString(), "ASC", out total);
        }

        public static tbTrangThaiDH GetById(int iD)
        {
            int total = 0;
            tbTrangThaiDHDAL spDAL = new tbTrangThaiDHDAL();
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbTrangThaiDHColumns.IdTrangThaiDH.ToString(), Condition.EQUAL, iD);
            tbTrangThaiDHCollection spCollection = spDAL.Get(cri .Criter ,0,0,tbTrangThaiDHColumns .IdTrangThaiDH .ToString (),
                                                    OrderDirection .ASC .ToString() ,out total );
            if (spCollection.Count > 0)
                return spCollection[0];
            return null;
        }
    }
}
